<template>

    <el-tree :data="data" :props="defaultProps"
     @node-click="handleNodeClick"></el-tree>
</template>

<script>
  let count = 1;
  export default {
    // set get
    data() {
      //  ajax
      return {
        data: [{
          label: '一级 1',
          children: [{
            label: '二级 1-1'
          }]
        }, {
          label: '一级 2',
          children: [{
            label: '二级 2-1'
          }, {
            label: '二级 2-2'
          }]
        }, {
          label: '一级 3',
          children: [{
            label: '二级 3-1'
          }, {
            label: '二级 3-2'
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'hi
        }
      };
    },
    methods: {
      handleNodeClick(data) {
        console.log(data.label);
        if(count==1) count=2;
        else return;
        this.data = [{
          label: '一级fuck 1',
          children: [{
            label: '二级 1-1'
          }]
        }]

      }
    }
  };
</script>
